const {getAll,addUser,getUserById,updateUserById,deleteUserById,login,avatar}
            = require("../controllers/user")
const {auth,equalUser,zdy} = require("../middlewares")

module.exports = function (router) {
    router.post("/addUser",addUser) //注册
    router.post("/login",login) //登录
    //auth:判断当前是否处于登录状态
    //equalUser:判断登录用户与指定用户是否是同一个
    router.post("/:id/avatar",auth,equalUser,avatar) //上传头像

    router.get("/getAll",getAll)
    router.get("/:id",getUserById)
    router.put("/:id",auth,equalUser,updateUserById)
    router.delete("/:id",auth,equalUser,deleteUserById)

    router.get("/img/zdy.jpg",zdy)
}